package com.lxm.action;

import com.alibaba.fastjson.JSONObject;
import com.lxm.entity.ReturnMessage;
import com.lxm.entity.SmsSenMsgEntity;
import com.lxm.sevice.wx.WxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author ：Administrator
 * @date :创建时间 2021/12/29 13:49
 */
@Controller
public class MDAction extends ActionBase {

    @Autowired
    private WxService wxService;

    @RequestMapping(value = "/queryHomePageData/{id}", method = RequestMethod.GET)
    @ResponseBody
    public String queryHomePageData(@PathVariable("id") String id) {
        Map<String, String> stringStringMap = wxService.queryMdDataById(id);
        return JSONObject.toJSONString(stringStringMap);
    }

    @RequestMapping(value = "/updateMd/{id}", method = RequestMethod.POST)
    @ResponseBody
    public ReturnMessage updateMd(@PathVariable("id") String id, @RequestBody String content) {
        wxService.upDateMdDataById(id, JSONObject.parseObject(content).getString("content"));
        return success();
    }
}
